package com.zly.framework.rbac.controller;

import com.zly.framework.rbac.model.entity.User;
import com.zly.framework.rbac.service.UserService;
import com.zly.framework.rbac.vaildate.EntityInsert;
import com.zly.framework.rbac.model.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/sys")
@Tag(name = "用户注册接口")
@RestController
public class RegisterController {
    @Resource
    private UserService userServiceImpl;

    @Operation(summary = "注册用户", description = "注册用户")
    @PostMapping("/register")
    public Result<Object> register(@Validated(value = {EntityInsert.class}) User user) {
        userServiceImpl.addNewUser(user);
        return Result.SUCCESS();
    }
}
